<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        /* 预定义字符集:针对常用的备选字符集提供的简化符号
        [0-9]  \d
        [0-9a-zA-Z_]  \w
        空格   \s
        .    --除了换行符以外所有的字符
         */
         var reg=/\d/g;
         var str="25679difjdDEGHYE_";
         var t="hello    world"
         console.log(str.replace(reg,"**"))    //**********difjdDEGHYE_
         console.log(str.replace(/\w/g,"**"))    //**********************************
         console.log(t.replace(/\s/g,"**"))     //hello********world
         console.log(str.replace(/./g,"*"))     //*****************
    </script> 
</body>
</html>